package study.io.springboot.upload.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import study.eggs.result.Result;
import study.eggs.result.Results;
import study.io.springboot.upload.service.ParallelCopyService;

@Slf4j
@RestController
@RequestMapping("/parallel_copy")
public class ParallelCopyController {

    @Autowired
    private ParallelCopyService parallelCopyService;

    @RequestMapping("/parallel_copy/v1")
    public Result parallel_copyV1(@RequestBody Request request) {
        parallelCopyService.copyV1(request.getUrlLt(), request.getDest());
        return Results.ok();
    }

    @RequestMapping("/parallel_copy/v2")
    public Result parallel_copyV2(@RequestBody Request request) {
        parallelCopyService.copyV2(request.getUrlLt(), request.getDest());
        return Results.ok();
    }
}
